import axios from 'axios';
// 封装 POST 请求函数
export async function postRequest(endpoint:string, data:any) {
  const baseUrl = 'http://localhost:3022';
  const url = `${baseUrl}${endpoint}`;
  try {
    const response = await axios.post(url, data);
    return response.data;
  } catch (error) {
    console.error('请求失败:', error);
    throw error;
  }
}